<?php
/**
 * +-------------------------------------------------------------
 * |Caption:
 * +-------------------------------------------------------------
 * |Author: Lenny
 * +-------------------------------------------------------------
 * |Email:  1685964109@qq.com
 * +-------------------------------------------------------------
 * |Date:   2024/6/17 下午4:38
 * +-------------------------------------------------------------
 */

namespace app\common\validate;

use think\Validate;

class LoginValidate extends Validate
{

    protected $rule = [
        'username'   => 'require|max:20',
        'password'   => 'require|max:20',
        'captcha'    => 'require|captcha',
    ];

    protected $message = [
        'username.require' => '用户名不能为空',
        'username.max'     => '用户名长度不能超过20个字符',
        'password.require' => '密码不能为空',
        'password.max'     => '密码长度不能超过20个字符',
        'captcha.require'  => '验证码不能为空',
        'captcha.captcha'  => '验证码错误',
    ];

    protected $scene = [
            'admin_login' =>['username','password'],
            'admin_add'   =>['username'],
    ];
}